package com.itheima.mapper;

import com.itheima.pojo.Member;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * @className MemberMapper
 */
@Mapper
public interface MemberMapper {

    List<Member> selectMembersByIds(@Param("memberIds") List<Integer> memberIds); // 批量查询Member

    @Select("SELECT COUNT(*) FROM t_member WHERE regTime BETWEEN #{startDate} AND #{endDate}")
    Integer countNewMembersBetweenDates(@Param("startDate") LocalDate startDate,
                                        @Param("endDate") LocalDate endDate); // 查询新增会员数量

    @Select("SELECT COUNT(*) FROM t_member")
    Integer countAllMembers(); // 查询会员总数
}
